﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ArtClub.DBAL;
using ArtClub.Controller;
using System.Web.UI.HtmlControls;
using System.ComponentModel;

namespace ArtClub.View
{
    public partial class BiddingPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AuctionCtr aCtr = new AuctionCtr();



            repBidding.DataSource = aCtr.getCurrentAuctions();
            repBidding.DataBind();
            if (!Page.IsPostBack)
            {  
            }
            
        }

        protected void repBidding_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Image img = e.Item.FindControl("imgPiece") as Image;
                Auction a = e.Item.DataItem as Auction;
                img.ImageUrl = a.Piece.image;
            }
            
            
        }

       

        //protected void myRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        //{
            //if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            //{
            //    HtmlGenericControl endTimeDiv = e.Item.FindControl("endTime") as HtmlGenericControl;
            //    // you can just pass "this" instead of "myDiv.ClientID" and get the ID from the DOM element
            //    //myDiv.Attributes.Add("onmouseover", "doStuff('" + myDiv.ClientID + "');");
            //    HtmlGenericControl timerDiv = e.Item.FindControl("timer") as HtmlGenericControl;
            //    Page.ClientScript.RegisterStartupScript(GetType(), "as", "timer('#" + endTimeDiv.ClientID + "', '" + timerDiv.ClientID + "')", true);
            //}
        //}
    }
}